/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sn.dao;

import java.util.List;
import org.springframework.stereotype.Component;
import sn.metier.Partage;

/**
 *
 * @author Pluce
 */
@Component
public class PartageDAOImpl extends GenericDAOImpl<Partage> implements PartageDAO {

    @Override
    protected Class<Partage> entityClass() {
        return Partage.class;
    }

    @Override
    public List<Partage> findByAuteur(Long idAuteur) {
        return (List<Partage>)em.createQuery("SELECT p FROM Partage p WHERE p.auteur.id = ? ORDER BY p.datePartagee DESC").setParameter(1, idAuteur).getResultList();
    }
    
}
